<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{.title}}</title>
    <link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
    <div class="container">
        <header class="admin-header">
            <h1>管理后台</h1>
            <div class="admin-actions">
                <a href="/admin/users" class="btn-link">用户管理</a>
                <a href="/" class="btn-link">返回首页</a>
                <a href="/admin/logout" class="btn-link">退出登录</a>
            </div>
        </header>

        <div class="shuoshuos-section">
            <h2>所有说说</h2>
            <div id="adminContainer">
                {{if .shuoshuos}}
                    {{range .shuoshuos}}
                    <div class="shuoshuo-item {{if .IsViolation}}violation{{end}}">
                        <div class="shuoshuo-header">
                            <span class="author">@{{.Nickname}}</span>
                            <span class="time">{{.CreatedAt.Format "2006-01-02 15:04"}}</span>
                        </div>
                        <div class="shuoshuo-content">{{.Content}}</div>
                        <div class="shuoshuo-meta">
                            <span class="status {{if .IsViolation}}status-violation{{else}}status-normal{{end}}">
                                {{if .IsViolation}}违规{{else}}正常{{end}}
                            </span>
                            <button class="toggle-btn" onclick="toggleViolation({{.ID}}, {{if .IsViolation}}true{{else}}false{{end}})">
                                {{if .IsViolation}}取消违规{{else}}标记违规{{end}}
                            </button>
                            <button class="delete-btn" onclick="deleteShuoshuo({{.ID}})">
                                删除
                            </button>
                        </div>
                    </div>
                    {{end}}
                {{else}}
                    <div class="empty-message">暂无内容</div>
                {{end}}
            </div>
        </div>
    </div>

    <script src="/static/js/admin.js"></script>
</body>
</html>

